package com.nineclock.approve.nodeResolver.impl;

import cn.hutool.json.JSONObject;
import com.nineclock.approve.nodeResolver.ProcessNodeResolver;
import org.activiti.bpmn.model.Process;
import org.activiti.bpmn.model.UserTask;

/**
 * 绘制 审批节点
 * @author 黑马程序员
 * @Company http://www.ithiema.com
 * @Version 1.0
 */
public class ApprovalNodeResolver extends ProcessNodeResolver {

    @Override
    public void addFlowNodeToActiviti(Process process, JSONObject currNode, JSONObject nextNode) {
        UserTask task = new UserTask();
        task.setId(getNodeId(currNode));
        task.setName(currNode.getStr("name"));

        task.setCategory("1"); //分类 1： 审批  2：抄送

        process.addFlowElement(task);

        //添加连线节点
        addSequenceFlow(process, currNode,nextNode);
    }
}
